<%  invoice = @payment.source.find_invoice  %>
<% if invoice %>
  <div class="bitpay_invoice_details">
    <h3>Bitpay Invoice Details</h3>
    <pre><%= JSON.pretty_generate(invoice) %></pre>
  </div>

  <%= link_to Spree.t(:bitpay_refresh_invoice), bitpay_refresh_url(payment: @payment), {id: "refresh_invoice", class: "button primary", title: Spree.t(:bitpay_refresh_invoice_description)} %>

  <div class="bitpay_invoice_details">
    <h3>Invoice</h3>
    <iframe id="bitpay_view_invoice_iframe"
            src="<%= j bitpay_view_invoice_url(source_id: @payment.source).html_safe %>"
            scrolling="no" 
            allowtransparency="true" 
            frameborder="0">
    </iframe>
    <br/>
    <%= link_to Spree.t(:bitpay_view_full_invoice), invoice["url"], {target: "_new"} %>
  </div>
<% else %>
  <p>No BitPay Invoice Available</p>
<% end %>
